package config

const (
	//GitQuarantinePath is the name of environment variable the keeps val of quarantine path.
	GitQuarantinePath = "GIT_QUARANTINE_PATH"
	//GitRepositoryPath is the name of environment variable the keeps val of repository path.
	GitRepositoryPath = "GIT_DIR"
)

var (
	//Repository is the repository path.
	Repository string
	//Quarantine is the path of quarantine area.
	Quarantine string
	//CommitInfo represents whether specific fields of a commit should be displayed.
	CommitInfo commitInfo

	//FromWeb indicates Whether the commit is from the web or not.
	FromWeb bool

	//QuickScan indicates whether scan commits from $GIT_QUARANTINE_PATH/info/commits
	QuickScan   bool
	NoQuickScan bool

	//BranchTip is the tip commit of a branch
	BranchTip string

	//Limit is the commits limit of a branch to be checked
	Limit int

	//Delimiter is a special string used to break up different parts of a commit
	Delimiter string

	//NoMerges indicates whether print merge-commits or not
	NoMerges bool

	//DisableStdout indicates whether print to stdout in middle process
	DisableStdout bool
)

type commitInfo struct {
	//Id indicates whether display commit id.
	ID bool
	//Message indicates whether display commit message.
	Message bool
	//CommittedTime indicates whether display commit time.
	CommittedTime bool
	//CommitterName indicates whether display committer name.
	CommitterName bool
	//CommitterEmail indicates whether display committer email.
	CommitterEmail bool
	//AuthoredTime indicates whether display authored time.
	AuthoredTime bool
	//AuthorName indicates whether display author name.
	AuthorName bool
	//AuthorEmail indicates whether display author email.
	AuthorEmail bool
}

//GetQuarantinePath returns Quarantine path.
func GetQuarantinePath() string {
	return Quarantine
}

//GetRepositoryPath returns repository path.
func GetRepositoryPath() string {
	return Repository
}

//GetCommitID returns a bool value to indicate whether to display commit id.
func GetCommitID() bool {
	return CommitInfo.ID
}

//GetCommitMessage returns a bool value to indicate whether to display commit message.
func GetCommitMessage() bool {
	return CommitInfo.Message
}

//GetCommitTime returns a bool value to indicate whether to display commit time.
func GetCommitTime() bool {
	return CommitInfo.CommittedTime
}

//GetCommitterName returns a bool value to indicate whether to display committer name.
func GetCommitterName() bool {
	return CommitInfo.CommitterName
}

//GetCommitterEmail returns a bool value to indicate whether to display committer email.
func GetCommitterEmail() bool {
	return CommitInfo.CommitterEmail
}

//GetAuthoredTime returns a bool value to indicate whether to display authored time.
func GetAuthoredTime() bool {
	return CommitInfo.AuthoredTime
}

//GetAuthorName returns a bool value to indicate whether to display author name.
func GetAuthorName() bool {
	return CommitInfo.AuthorName
}

//GetAuthorEmail returns a bool value to indicate whether to display author email.
func GetAuthorEmail() bool {
	return CommitInfo.AuthorEmail
}

//IsCommitFromWeb returns a bool value to indicate whether the commit is from web
func IsCommitFromWeb() bool {
	return FromWeb
}

func UseQuickScan() bool {
	return QuickScan
}

func GetBranchTip() string {
	return BranchTip
}

func GetLimit() int {
	return Limit
}

func GetDelimiter() string {
	return Delimiter
}

func GetNoMerges() bool {
	return NoMerges
}

func GetDisableStdout() bool {
	return DisableStdout
}

func SetDisableStdout() {
	DisableStdout = true
}
